import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';

class AppBerPage extends StatefulWidget {
  const AppBerPage({Key? key}) : super(key: key);

  @override
  State<AppBerPage> createState() => _AppBerPageState();
}

class _AppBerPageState extends State<AppBerPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title:
            TextView.text("导航栏", fontSize: YJSize.SP_16, isLineHeight: false),
        leading: InkWell(
          child: const Icon(
            Icons.arrow_back_ios,
            size: 16,
            color: Colors.black87,
          ),
          onTap: () {
            Navigator.pop(context);
          },
        ),
        backgroundColor: YJColors.WHITE,
      ),
      body: Stack(
        children: [
          Container(
            color: Colors.transparent,
            width: YJSize.screenWidth,
            height: YJSize.screenHeight,
          ),
          buildCenter(context)
        ],
      ),
      backgroundColor: YJColors.BACKGROUND_COLOR,
    );
  }

  buildCenter(BuildContext context) {
    final List<Widget> actions = [];
    actions.add(const Icon(
      Icons.more_horiz,
      size: 20,
      color: Colors.black87,
    ));
    actions.add(const SizedBox(
      width: 16,
    ));
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        const SizedBox(height: 20),
        YJAppBar(
          title: TextView.text("标题", isLineHeight: false),
          backgroundColor: YJColors.WHITE,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          title: TextView.text("标题", isLineHeight: false),
          actions: actions,
          backgroundColor: YJColors.WHITE,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          title: TextView.text("标题标题标题标题标题标题标题标题标题"),
          actions: actions,
          backgroundColor: YJColors.WHITE,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          leadingType: YJAppBarType.none,
          title: TextView.text("标题", isLineHeight: false),
          backgroundColor: YJColors.WHITE,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          leadingType: YJAppBarType.none,
          backgroundColor: YJColors.WHITE,
          isSearchBar: true,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          actions: actions,
          title: TextView.text("标题标题标题标题标题标题标题标题标题"),
          backgroundColor: YJColors.WHITE,
          isSearchBar: true,
        ),
        const SizedBox(height: 20),
        YJAppBar(
          leading: InkWell(
            child: Container(
              width: 80,
              child: Row(
                children: [
                  const SizedBox(width: 16),
                  const Icon(
                    Icons.arrow_back_ios,
                    size: 16,
                    color: Colors.black87,
                  ),
                  TextView.text("返回")
                ],
              ),
            ),
            onTap: () {
              Navigator.pop(context);
            },
          ),
          title: TextView.text("标题", isLineHeight: false),
          // actions: actions,
          backgroundColor: YJColors.THEME_COLOR,
        ),
      ],
    );
  }
}
